﻿USE [master]
GO

/****** Object:  Database [DBFastPizza]    Script Date: 09/24/2012 20:37:56 ******/
CREATE DATABASE [DBFastPizza] ON  PRIMARY 
( NAME = N'DBFastPizza', FILENAME = N'c:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\DBFastPizza.mdf' , SIZE = 2304KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
 LOG ON 
( NAME = N'DBFastPizza_log', FILENAME = N'c:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\DBFastPizza_log.LDF' , SIZE = 576KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO

ALTER DATABASE [DBFastPizza] SET COMPATIBILITY_LEVEL = 100
GO

IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [DBFastPizza].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO

ALTER DATABASE [DBFastPizza] SET ANSI_NULL_DEFAULT OFF 
GO

ALTER DATABASE [DBFastPizza] SET ANSI_NULLS OFF 
GO

ALTER DATABASE [DBFastPizza] SET ANSI_PADDING OFF 
GO

ALTER DATABASE [DBFastPizza] SET ANSI_WARNINGS OFF 
GO

ALTER DATABASE [DBFastPizza] SET ARITHABORT OFF 
GO

ALTER DATABASE [DBFastPizza] SET AUTO_CLOSE ON 
GO

ALTER DATABASE [DBFastPizza] SET AUTO_CREATE_STATISTICS ON 
GO

ALTER DATABASE [DBFastPizza] SET AUTO_SHRINK OFF 
GO

ALTER DATABASE [DBFastPizza] SET AUTO_UPDATE_STATISTICS ON 
GO

ALTER DATABASE [DBFastPizza] SET CURSOR_CLOSE_ON_COMMIT OFF 
GO

ALTER DATABASE [DBFastPizza] SET CURSOR_DEFAULT  GLOBAL 
GO

ALTER DATABASE [DBFastPizza] SET CONCAT_NULL_YIELDS_NULL OFF 
GO

ALTER DATABASE [DBFastPizza] SET NUMERIC_ROUNDABORT OFF 
GO

ALTER DATABASE [DBFastPizza] SET QUOTED_IDENTIFIER OFF 
GO

ALTER DATABASE [DBFastPizza] SET RECURSIVE_TRIGGERS OFF 
GO

ALTER DATABASE [DBFastPizza] SET  ENABLE_BROKER 
GO

ALTER DATABASE [DBFastPizza] SET AUTO_UPDATE_STATISTICS_ASYNC OFF 
GO

ALTER DATABASE [DBFastPizza] SET DATE_CORRELATION_OPTIMIZATION OFF 
GO

ALTER DATABASE [DBFastPizza] SET TRUSTWORTHY OFF 
GO

ALTER DATABASE [DBFastPizza] SET ALLOW_SNAPSHOT_ISOLATION OFF 
GO

ALTER DATABASE [DBFastPizza] SET PARAMETERIZATION SIMPLE 
GO

ALTER DATABASE [DBFastPizza] SET READ_COMMITTED_SNAPSHOT OFF 
GO

ALTER DATABASE [DBFastPizza] SET HONOR_BROKER_PRIORITY OFF 
GO

ALTER DATABASE [DBFastPizza] SET  READ_WRITE 
GO

ALTER DATABASE [DBFastPizza] SET RECOVERY SIMPLE 
GO

ALTER DATABASE [DBFastPizza] SET  MULTI_USER 
GO

ALTER DATABASE [DBFastPizza] SET PAGE_VERIFY CHECKSUM  
GO

ALTER DATABASE [DBFastPizza] SET DB_CHAINING OFF 
GO



/****** Object:  Table [dbo].[TBRegiaoEntrega]    Script Date: 09/24/2012 20:37:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TBRegiaoEntrega](
	[IDRegiaoEntrega] [int] IDENTITY(1,1) NOT NULL,
	[NORegiaoEntrega] [varchar](30) NOT NULL,
	[VLTaxaEntrega] [money] NOT NULL,
 CONSTRAINT [PK_TBRegiaoEntrega] PRIMARY KEY CLUSTERED 
(
	[IDRegiaoEntrega] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[TBFuncao]    Script Date: 09/24/2012 20:37:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TBFuncao](
	[IDFuncao] [int] IDENTITY(1,1) NOT NULL,
	[DEFuncao] [varchar](30) NOT NULL,
 CONSTRAINT [PK_TBFuncao] PRIMARY KEY CLUSTERED 
(
	[IDFuncao] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[TBLoja]    Script Date: 09/24/2012 20:37:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TBLoja](
	[IDLoja] [int] IDENTITY(1,1) NOT NULL,
	[DELoja] [varchar](50) NOT NULL,
 CONSTRAINT [PK_TBLoja] PRIMARY KEY CLUSTERED 
(
	[IDLoja] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[TBGrupo]    Script Date: 09/24/2012 20:37:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TBGrupo](
	[IDGrupo] [int] IDENTITY(1,1) NOT NULL,
	[DEGrupo] [varchar](30) NOT NULL,
 CONSTRAINT [PK_TBGrupo] PRIMARY KEY CLUSTERED 
(
	[IDGrupo] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[TBTipoPagamento]    Script Date: 09/24/2012 20:37:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TBTipoPagamento](
	[IDTipoPagamento] [int] IDENTITY(1,1) NOT NULL,
	[DETipoPagamento] [varchar](30) NOT NULL,
	[STUnico] [bit] NOT NULL,
	[STAtivo] [bit] NOT NULL,
 CONSTRAINT [PK_TBTipoPagamento] PRIMARY KEY CLUSTERED 
(
	[IDTipoPagamento] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[TBTamanho]    Script Date: 09/24/2012 20:37:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TBTamanho](
	[IDTamanho] [int] IDENTITY(1,1) NOT NULL,
	[DETamanho] [varchar](20) NOT NULL,
	[Sigla] [varchar](5) NOT NULL,
 CONSTRAINT [PK_TBTamanho] PRIMARY KEY CLUSTERED 
(
	[IDTamanho] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[TBCliente]    Script Date: 09/24/2012 20:37:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TBCliente](
	[IDCliente] [int] IDENTITY(1,1) NOT NULL,
	[NOCliente] [varchar](50) NOT NULL,
	[STBloqueado] [bit] NOT NULL,
	[ENDCliente] [varchar](100) NULL,
	[Bairro] [varchar](30) NULL,
	[Cidade] [varchar](30) NULL,
	[UF] [char](2) NULL,
	[CEP] [char](8) NULL,
	[PontoReferencia] [varchar](100) NULL,
	[TelResidencial] [char](8) NOT NULL,
	[TelResidencial2] [char](8) NULL,
	[TelComercial] [char](8) NULL,
	[Email] [varchar](50) NULL,
	[DTNascimento] [date] NULL,
	[OBS] [varchar](600) NULL,
	[IDRegiaoEntrega] [int] NOT NULL,
	[STMailMarketing] [bit] NOT NULL,
	[NRContadorPizza] [smallint] NOT NULL,
 CONSTRAINT [PK_TBCliente] PRIMARY KEY CLUSTERED 
(
	[IDCliente] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[TBSubGrupo]    Script Date: 09/24/2012 20:37:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TBSubGrupo](
	[IDSubGrupo] [int] IDENTITY(1,1) NOT NULL,
	[DESubGrupo] [varchar](30) NOT NULL,
	[IDGrupo] [int] NOT NULL,
 CONSTRAINT [PK_TBSubGrupo] PRIMARY KEY CLUSTERED 
(
	[IDSubGrupo] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[TBFuncionario]    Script Date: 09/24/2012 20:37:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TBFuncionario](
	[IDFuncionario] [int] IDENTITY(1,1) NOT NULL,
	[NOFuncionario] [varchar](50) NOT NULL,
	[Bairro] [varchar](30) NULL,
	[Cidade] [varchar](30) NULL,
	[CEP] [char](8) NULL,
	[UF] [char](2) NULL,
	[Telefone] [char](10) NOT NULL,
	[Celular] [char](10) NULL,
	[STAdministrador] [bit] NOT NULL,
	[IDFuncao] [int] NOT NULL,
	[Login] [varchar](15) NULL,
	[Senha] [varchar](64) NULL,
	[STBloqueado] [bit] NOT NULL,
 CONSTRAINT [PK_TBFuncionario] PRIMARY KEY CLUSTERED 
(
	[IDFuncionario] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[TBEnderecoCliente]    Script Date: 09/24/2012 20:37:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TBEnderecoCliente](
	[IDEndereco] [int] IDENTITY(1,1) NOT NULL,
	[IDCliente] [int] NOT NULL,
	[ENDCliente] [varchar](100) NOT NULL,
	[PontoReferencia] [varchar](100) NULL,
 CONSTRAINT [PK_TBEnderecoCliente] PRIMARY KEY CLUSTERED 
(
	[IDEndereco] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[TBConfig]    Script Date: 09/24/2012 20:37:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TBConfig](
	[IDConfig] [int] IDENTITY(1,1) NOT NULL,
	[IDGrupoPizza] [int] NOT NULL,
	[IDGrupoBebida] [int] NOT NULL,
	[DENomeLoja] [varchar](30) NOT NULL,
	[IDTamanhoGratisRefri] [int] NULL,
	[IDSubGrupoSuco] [int] NULL,
	[IDTipoPagamentoCupom] [int] NULL,
	[IDSubGrupoClassic] [int] NULL,
	[IDTamanhoPizzaPequena] [int] NULL,
	[IDTamanhoPizzaMedia] [int] NULL,
	[IDPrinter] [smallint] NULL,
	[Porta] [varchar](20) NULL,
	[IDLoja] [int] NOT NULL,
	[NovidadeVisualizada] [bit] NOT NULL,
 CONSTRAINT [PK_TBConfig] PRIMARY KEY CLUSTERED 
(
	[IDConfig] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[TBProduto]    Script Date: 09/24/2012 20:37:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TBProduto](
	[IDProduto] [int] IDENTITY(1,1) NOT NULL,
	[DEProduto] [varchar](50) NOT NULL,
	[IDSubGrupo] [int] NOT NULL,
	[STAtivo] [bit] NOT NULL,
 CONSTRAINT [PK_TBProduto] PRIMARY KEY CLUSTERED 
(
	[IDProduto] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[TBSubGrupoTamanho]    Script Date: 09/24/2012 20:37:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TBSubGrupoTamanho](
	[IDSubGrupo] [int] NOT NULL,
	[IDTamanho] [int] NOT NULL,
	[Preco] [money] NOT NULL,
 CONSTRAINT [PK_TBSubGrupoTamanho] PRIMARY KEY CLUSTERED 
(
	[IDSubGrupo] ASC,
	[IDTamanho] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[TBVenda]    Script Date: 09/24/2012 20:37:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TBVenda](
	[IDVenda] [int] IDENTITY(1,1) NOT NULL,
	[IDCliente] [int] NOT NULL,
	[DTVenda] [date] NOT NULL,
	[HRVenda] [char](5) NOT NULL,
	[IDRegiaoEntrega] [int] NOT NULL,
	[VLTotal] [money] NOT NULL,
	[VLTaxaEntrega] [money] NOT NULL,
	[VLTroco] [money] NOT NULL,
	[OBS] [varchar](300) NULL,
	[VLDesconto] [money] NOT NULL,
	[STEnviada] [bit] NOT NULL,
	[VLAcrescimo] [money] NOT NULL,
	[DECancelado] [varchar](300) NULL,
	[STCancelado] [bit] NOT NULL,
 CONSTRAINT [PK_TBVenda] PRIMARY KEY CLUSTERED 
(
	[IDVenda] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[TBVendaItem]    Script Date: 09/24/2012 20:37:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TBVendaItem](
	[IDProduto] [int] NOT NULL,
	[IDVenda] [int] NOT NULL,
	[IDTamanho] [int] NOT NULL,
	[VLUnitario] [money] NOT NULL,
	[Qtd] [int] NOT NULL,
	[IDProdutoMetade] [int] NULL,
	[VLDesconto] [money] NULL,
	[VLTotal] [money] NOT NULL,
	[STBorda] [bit] NULL,
	[TPBorda] [smallint] NULL,
	[OBS] [varchar](255) NULL,
	[STCupom] [bit] NOT NULL,
	[IDVendaItem] [int] IDENTITY(1,1) NOT NULL,
 CONSTRAINT [PK_TBVendaItem_1] PRIMARY KEY CLUSTERED 
(
	[IDVendaItem] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[TBSaidaChegada]    Script Date: 09/24/2012 20:37:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TBSaidaChegada](
	[IDVenda] [int] NOT NULL,
	[IDMotoboy] [int] NULL,
	[HoraSaida] [char](5) NULL,
	[HoraChegada] [char](5) NULL,
 CONSTRAINT [PK_TBSaidaChegada] PRIMARY KEY CLUSTERED 
(
	[IDVenda] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[TBPromocao]    Script Date: 09/24/2012 20:37:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TBPromocao](
	[IDPromocao] [int] IDENTITY(1,1) NOT NULL,
	[NOPromocao] [varchar](50) NOT NULL,
	[DTInicio] [date] NULL,
	[DTFim] [date] NULL,
	[STParaSempre] [bit] NOT NULL,
	[DiasSemana] [varchar](13) NULL,
	[VLDesconto] [decimal](5, 2) NULL,
	[IDProdutoGratis] [int] NULL,
	[IDProdutoPromocao] [int] NULL,
	[VLDescontoPromocao] [decimal](5, 2) NULL,
	[STAtivo] [bit] NOT NULL,
 CONSTRAINT [PK_TBPromocao] PRIMARY KEY CLUSTERED 
(
	[IDPromocao] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[TBPagamento]    Script Date: 09/24/2012 20:37:16 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TBPagamento](
	[IDVenda] [int] NOT NULL,
	[IDTipoPagamento] [int] NOT NULL,
	[VLPagamento] [money] NOT NULL,
 CONSTRAINT [PK_TBPagamento] PRIMARY KEY CLUSTERED 
(
	[IDVenda] ASC,
	[IDTipoPagamento] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Default [DF_TBCliente_STMailMarketing]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBCliente] ADD  CONSTRAINT [DF_TBCliente_STMailMarketing]  DEFAULT ((0)) FOR [STMailMarketing]
GO
/****** Object:  Default [DF_TBCliente_NRContadorPizza]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBCliente] ADD  CONSTRAINT [DF_TBCliente_NRContadorPizza]  DEFAULT ((0)) FOR [NRContadorPizza]
GO
/****** Object:  Default [DF_TBConfig_IDLoja]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBConfig] ADD  CONSTRAINT [DF_TBConfig_IDLoja]  DEFAULT ((0)) FOR [IDLoja]
GO
/****** Object:  Default [DF_TBConfig_NovidadeVisualizada]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBConfig] ADD  CONSTRAINT [DF_TBConfig_NovidadeVisualizada]  DEFAULT ((1)) FOR [NovidadeVisualizada]
GO
/****** Object:  Default [DF_TBFuncionario_STBloqueado]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBFuncionario] ADD  CONSTRAINT [DF_TBFuncionario_STBloqueado]  DEFAULT ((0)) FOR [STBloqueado]
GO
/****** Object:  Default [DF_TBProduto_STAtivo]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBProduto] ADD  CONSTRAINT [DF_TBProduto_STAtivo]  DEFAULT ((1)) FOR [STAtivo]
GO
/****** Object:  Default [DF_TBTipoPagamento_STUnico]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBTipoPagamento] ADD  CONSTRAINT [DF_TBTipoPagamento_STUnico]  DEFAULT ((0)) FOR [STUnico]
GO
/****** Object:  Default [DF_TBTipoPagamento_STAtivo]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBTipoPagamento] ADD  CONSTRAINT [DF_TBTipoPagamento_STAtivo]  DEFAULT ((1)) FOR [STAtivo]
GO
/****** Object:  Default [DF_TBVenda_VLDesconto]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBVenda] ADD  CONSTRAINT [DF_TBVenda_VLDesconto]  DEFAULT ((0)) FOR [VLDesconto]
GO
/****** Object:  Default [DF_TBVenda_STEnviada]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBVenda] ADD  CONSTRAINT [DF_TBVenda_STEnviada]  DEFAULT ((0)) FOR [STEnviada]
GO
/****** Object:  Default [DF_TBVenda_VLAcrescimo]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBVenda] ADD  CONSTRAINT [DF_TBVenda_VLAcrescimo]  DEFAULT ((0)) FOR [VLAcrescimo]
GO
/****** Object:  Default [DF_TBVenda_DECancelado]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBVenda] ADD  CONSTRAINT [DF_TBVenda_DECancelado]  DEFAULT ((0)) FOR [DECancelado]
GO
/****** Object:  Default [DF_TBVenda_STCancelado]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBVenda] ADD  CONSTRAINT [DF_TBVenda_STCancelado]  DEFAULT ((0)) FOR [STCancelado]
GO
/****** Object:  Default [DF_TBVendaItem_STCupom]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBVendaItem] ADD  CONSTRAINT [DF_TBVendaItem_STCupom]  DEFAULT ((0)) FOR [STCupom]
GO
/****** Object:  ForeignKey [FK_TBCliente_TBRegiaoEntrega]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBCliente]  WITH CHECK ADD  CONSTRAINT [FK_TBCliente_TBRegiaoEntrega] FOREIGN KEY([IDRegiaoEntrega])
REFERENCES [dbo].[TBRegiaoEntrega] ([IDRegiaoEntrega])
GO
ALTER TABLE [dbo].[TBCliente] CHECK CONSTRAINT [FK_TBCliente_TBRegiaoEntrega]
GO
/****** Object:  ForeignKey [FK_TBConfig_TBGrupo]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBConfig]  WITH CHECK ADD  CONSTRAINT [FK_TBConfig_TBGrupo] FOREIGN KEY([IDGrupoPizza])
REFERENCES [dbo].[TBGrupo] ([IDGrupo])
GO
ALTER TABLE [dbo].[TBConfig] CHECK CONSTRAINT [FK_TBConfig_TBGrupo]
GO
/****** Object:  ForeignKey [FK_TBConfig_TBGrupo1]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBConfig]  WITH CHECK ADD  CONSTRAINT [FK_TBConfig_TBGrupo1] FOREIGN KEY([IDGrupoBebida])
REFERENCES [dbo].[TBGrupo] ([IDGrupo])
GO
ALTER TABLE [dbo].[TBConfig] CHECK CONSTRAINT [FK_TBConfig_TBGrupo1]
GO
/****** Object:  ForeignKey [FK_TBConfig_TBSubGrupo]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBConfig]  WITH CHECK ADD  CONSTRAINT [FK_TBConfig_TBSubGrupo] FOREIGN KEY([IDSubGrupoSuco])
REFERENCES [dbo].[TBSubGrupo] ([IDSubGrupo])
GO
ALTER TABLE [dbo].[TBConfig] CHECK CONSTRAINT [FK_TBConfig_TBSubGrupo]
GO
/****** Object:  ForeignKey [FK_TBConfig_TBSubGrupo1]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBConfig]  WITH CHECK ADD  CONSTRAINT [FK_TBConfig_TBSubGrupo1] FOREIGN KEY([IDSubGrupoClassic])
REFERENCES [dbo].[TBSubGrupo] ([IDSubGrupo])
GO
ALTER TABLE [dbo].[TBConfig] CHECK CONSTRAINT [FK_TBConfig_TBSubGrupo1]
GO
/****** Object:  ForeignKey [FK_TBConfig_TBTamanho]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBConfig]  WITH CHECK ADD  CONSTRAINT [FK_TBConfig_TBTamanho] FOREIGN KEY([IDTamanhoGratisRefri])
REFERENCES [dbo].[TBTamanho] ([IDTamanho])
GO
ALTER TABLE [dbo].[TBConfig] CHECK CONSTRAINT [FK_TBConfig_TBTamanho]
GO
/****** Object:  ForeignKey [FK_TBConfig_TBTamanho1]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBConfig]  WITH CHECK ADD  CONSTRAINT [FK_TBConfig_TBTamanho1] FOREIGN KEY([IDTamanhoPizzaPequena])
REFERENCES [dbo].[TBTamanho] ([IDTamanho])
GO
ALTER TABLE [dbo].[TBConfig] CHECK CONSTRAINT [FK_TBConfig_TBTamanho1]
GO
/****** Object:  ForeignKey [FK_TBConfig_TBTamanho2]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBConfig]  WITH CHECK ADD  CONSTRAINT [FK_TBConfig_TBTamanho2] FOREIGN KEY([IDTamanhoPizzaMedia])
REFERENCES [dbo].[TBTamanho] ([IDTamanho])
GO
ALTER TABLE [dbo].[TBConfig] CHECK CONSTRAINT [FK_TBConfig_TBTamanho2]
GO
/****** Object:  ForeignKey [FK_TBConfig_TBTipoPagamento]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBConfig]  WITH CHECK ADD  CONSTRAINT [FK_TBConfig_TBTipoPagamento] FOREIGN KEY([IDTipoPagamentoCupom])
REFERENCES [dbo].[TBTipoPagamento] ([IDTipoPagamento])
GO
ALTER TABLE [dbo].[TBConfig] CHECK CONSTRAINT [FK_TBConfig_TBTipoPagamento]
GO
/****** Object:  ForeignKey [FK_TBEnderecoCliente_TBCliente]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBEnderecoCliente]  WITH CHECK ADD  CONSTRAINT [FK_TBEnderecoCliente_TBCliente] FOREIGN KEY([IDCliente])
REFERENCES [dbo].[TBCliente] ([IDCliente])
GO
ALTER TABLE [dbo].[TBEnderecoCliente] CHECK CONSTRAINT [FK_TBEnderecoCliente_TBCliente]
GO
/****** Object:  ForeignKey [FK_TBFuncionario_TBFuncao]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBFuncionario]  WITH CHECK ADD  CONSTRAINT [FK_TBFuncionario_TBFuncao] FOREIGN KEY([IDFuncao])
REFERENCES [dbo].[TBFuncao] ([IDFuncao])
GO
ALTER TABLE [dbo].[TBFuncionario] CHECK CONSTRAINT [FK_TBFuncionario_TBFuncao]
GO
/****** Object:  ForeignKey [FK_TBPagamento_TBTipoPagamento]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBPagamento]  WITH CHECK ADD  CONSTRAINT [FK_TBPagamento_TBTipoPagamento] FOREIGN KEY([IDTipoPagamento])
REFERENCES [dbo].[TBTipoPagamento] ([IDTipoPagamento])
GO
ALTER TABLE [dbo].[TBPagamento] CHECK CONSTRAINT [FK_TBPagamento_TBTipoPagamento]
GO
/****** Object:  ForeignKey [FK_TBPagamento_TBVenda]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBPagamento]  WITH CHECK ADD  CONSTRAINT [FK_TBPagamento_TBVenda] FOREIGN KEY([IDVenda])
REFERENCES [dbo].[TBVenda] ([IDVenda])
GO
ALTER TABLE [dbo].[TBPagamento] CHECK CONSTRAINT [FK_TBPagamento_TBVenda]
GO
/****** Object:  ForeignKey [FK_TBProduto_TBSubGrupo]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBProduto]  WITH CHECK ADD  CONSTRAINT [FK_TBProduto_TBSubGrupo] FOREIGN KEY([IDSubGrupo])
REFERENCES [dbo].[TBSubGrupo] ([IDSubGrupo])
GO
ALTER TABLE [dbo].[TBProduto] CHECK CONSTRAINT [FK_TBProduto_TBSubGrupo]
GO
/****** Object:  ForeignKey [FK_TBPromocao_TBProduto]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBPromocao]  WITH CHECK ADD  CONSTRAINT [FK_TBPromocao_TBProduto] FOREIGN KEY([IDProdutoGratis])
REFERENCES [dbo].[TBProduto] ([IDProduto])
GO
ALTER TABLE [dbo].[TBPromocao] CHECK CONSTRAINT [FK_TBPromocao_TBProduto]
GO
/****** Object:  ForeignKey [FK_TBPromocao_TBProduto1]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBPromocao]  WITH CHECK ADD  CONSTRAINT [FK_TBPromocao_TBProduto1] FOREIGN KEY([IDProdutoPromocao])
REFERENCES [dbo].[TBProduto] ([IDProduto])
GO
ALTER TABLE [dbo].[TBPromocao] CHECK CONSTRAINT [FK_TBPromocao_TBProduto1]
GO
/****** Object:  ForeignKey [FK_TBSaidaChegada_TBFuncionario]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBSaidaChegada]  WITH CHECK ADD  CONSTRAINT [FK_TBSaidaChegada_TBFuncionario] FOREIGN KEY([IDMotoboy])
REFERENCES [dbo].[TBFuncionario] ([IDFuncionario])
GO
ALTER TABLE [dbo].[TBSaidaChegada] CHECK CONSTRAINT [FK_TBSaidaChegada_TBFuncionario]
GO
/****** Object:  ForeignKey [FK_TBSaidaChegada_TBVenda]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBSaidaChegada]  WITH CHECK ADD  CONSTRAINT [FK_TBSaidaChegada_TBVenda] FOREIGN KEY([IDVenda])
REFERENCES [dbo].[TBVenda] ([IDVenda])
GO
ALTER TABLE [dbo].[TBSaidaChegada] CHECK CONSTRAINT [FK_TBSaidaChegada_TBVenda]
GO
/****** Object:  ForeignKey [FK_TBSubGrupo_TBGrupo]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBSubGrupo]  WITH CHECK ADD  CONSTRAINT [FK_TBSubGrupo_TBGrupo] FOREIGN KEY([IDGrupo])
REFERENCES [dbo].[TBGrupo] ([IDGrupo])
GO
ALTER TABLE [dbo].[TBSubGrupo] CHECK CONSTRAINT [FK_TBSubGrupo_TBGrupo]
GO
/****** Object:  ForeignKey [FK_TBSubGrupoTamanho_TBSubGrupo]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBSubGrupoTamanho]  WITH CHECK ADD  CONSTRAINT [FK_TBSubGrupoTamanho_TBSubGrupo] FOREIGN KEY([IDSubGrupo])
REFERENCES [dbo].[TBSubGrupo] ([IDSubGrupo])
GO
ALTER TABLE [dbo].[TBSubGrupoTamanho] CHECK CONSTRAINT [FK_TBSubGrupoTamanho_TBSubGrupo]
GO
/****** Object:  ForeignKey [FK_TBSubGrupoTamanho_TBTamanho]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBSubGrupoTamanho]  WITH CHECK ADD  CONSTRAINT [FK_TBSubGrupoTamanho_TBTamanho] FOREIGN KEY([IDTamanho])
REFERENCES [dbo].[TBTamanho] ([IDTamanho])
GO
ALTER TABLE [dbo].[TBSubGrupoTamanho] CHECK CONSTRAINT [FK_TBSubGrupoTamanho_TBTamanho]
GO
/****** Object:  ForeignKey [FK_TBVenda_TBCliente]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBVenda]  WITH CHECK ADD  CONSTRAINT [FK_TBVenda_TBCliente] FOREIGN KEY([IDCliente])
REFERENCES [dbo].[TBCliente] ([IDCliente])
GO
ALTER TABLE [dbo].[TBVenda] CHECK CONSTRAINT [FK_TBVenda_TBCliente]
GO
/****** Object:  ForeignKey [FK_TBVenda_TBRegiaoEntrega]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBVenda]  WITH CHECK ADD  CONSTRAINT [FK_TBVenda_TBRegiaoEntrega] FOREIGN KEY([IDRegiaoEntrega])
REFERENCES [dbo].[TBRegiaoEntrega] ([IDRegiaoEntrega])
GO
ALTER TABLE [dbo].[TBVenda] CHECK CONSTRAINT [FK_TBVenda_TBRegiaoEntrega]
GO
/****** Object:  ForeignKey [FK_TBVendaItem_TBProduto]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBVendaItem]  WITH CHECK ADD  CONSTRAINT [FK_TBVendaItem_TBProduto] FOREIGN KEY([IDProduto])
REFERENCES [dbo].[TBProduto] ([IDProduto])
GO
ALTER TABLE [dbo].[TBVendaItem] CHECK CONSTRAINT [FK_TBVendaItem_TBProduto]
GO
/****** Object:  ForeignKey [FK_TBVendaItem_TBProduto1]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBVendaItem]  WITH CHECK ADD  CONSTRAINT [FK_TBVendaItem_TBProduto1] FOREIGN KEY([IDProdutoMetade])
REFERENCES [dbo].[TBProduto] ([IDProduto])
GO
ALTER TABLE [dbo].[TBVendaItem] CHECK CONSTRAINT [FK_TBVendaItem_TBProduto1]
GO
/****** Object:  ForeignKey [FK_TBVendaItem_TBTamanho]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBVendaItem]  WITH CHECK ADD  CONSTRAINT [FK_TBVendaItem_TBTamanho] FOREIGN KEY([IDTamanho])
REFERENCES [dbo].[TBTamanho] ([IDTamanho])
GO
ALTER TABLE [dbo].[TBVendaItem] CHECK CONSTRAINT [FK_TBVendaItem_TBTamanho]
GO
/****** Object:  ForeignKey [FK_TBVendaItem_TBVenda]    Script Date: 09/24/2012 20:37:16 ******/
ALTER TABLE [dbo].[TBVendaItem]  WITH CHECK ADD  CONSTRAINT [FK_TBVendaItem_TBVenda] FOREIGN KEY([IDVenda])
REFERENCES [dbo].[TBVenda] ([IDVenda])
GO
ALTER TABLE [dbo].[TBVendaItem] CHECK CONSTRAINT [FK_TBVendaItem_TBVenda]
GO
